<template>
	<view class="Wrapper">
		<navBar title="AI合同审查"></navBar>
		<view class="Box">
			<image :src="staticImg('SC.png')" mode="aspectFill" class="Img"></image>
			<text class="black size36 bold500">请上传合同文件</text>
			<view class="annotation">注：合同文件仅支持doc、docx、pdf格式大小 在10M以内</view>
			<view class="upladBtn" @click="uploadBtn">上传</view>
		</view>
	</view>
</template>

<script setup>
	import { ref } from 'vue';
	import { uploadContract } from '@/utils/utils.js';
	import { onLoad } from '@dcloudio/uni-app';
	import {
		Toast,
		staticImg,
		tampToDate,
		getFileExtension,
		uploadFile,
		showLoading,
		hideLoading,
	} from '@/utils/utils.js';
	const pageData = ref([]);
	const uploadBtn = (index) => {
		// #ifdef MP-WEIXIN
		wx.chooseMessageFile({
			count: 1,
			type: 'file',
			success: (res) => {
				const tempFiles = res.tempFiles;
				console.log(tempFiles, 'tempFiles');
				for (let item of tempFiles) {
					uploadContract(item.path).then((result) => {
						pageData.value[index].push(result);
					});
				}
				console.log(pageData.value, 'pageData.value');
			},
			fail: (err) => {
				console.log(err);
			},
		});
		// #endif
	};
</script>

<style lang="scss" scoped>
	.Wrapper {
		width: 100vw;
		height: 100vh;
		display: flex;
		flex-direction: column;
		align-items: center;
		padding-top: 200rpx;
		.Box {
			display: flex;
			flex-direction: column;
			align-items: center;
			.Img {
				width: 366rpx;
				height: 366rpx;
				display: block;
			}
			.annotation {
				width: 100%;
				padding: 24rpx 120rpx;
				color: #666666;
				font-size: 26rpx;
				text-align: center;
			}
			.upladBtn {
				width: 267rpx;
				height: 80rpx;
				background-color: $color_008;
				color: #fff;
				font-size: 28rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				border-radius: 10rpx;
				margin-top: 20rpx;
				letter-spacing: 10rpx;
			}
		}
	}
</style>
